package Game;

public abstract class DamageEffect extends Effect {
	public DamageEffect(String _name, String _desc, int[] actives) {
		super(_name, _desc, actives);
	}
	
	public boolean isConditionMet(Damage damage) {
		for (int i = 0; i < activeConditions.length; i++) {
			if (activeConditions[i]) {
				switch (i) {
				case ACTIVE_DAMAGED:
					if (!damage.healing)
						return true;
				case ACTIVE_HEALED:
					if (damage.healing)
						return true;
					
				case ACTIVE_PHYSICAL_SKILL:
					if (damage.fromSkill && !damage.magical)
						return true;
				case ACTIVE_MAGICAL_SKILL:
					if (damage.fromSkill && damage.magical)
						return true;
				case ACTIVE_HEALING:
					if (damage.healing)
						return true;
					
				case ACTIVE_NORMAL_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_NORMAL))
						return true;
				case ACTIVE_FIRE_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_FIRE))
						return true;
				case ACTIVE_WIND_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_WIND))
						return true;
				case ACTIVE_EARTH_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_EARTH))
						return true;
				case ACTIVE_THUNDER_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_THUNDER))
						return true;
				case ACTIVE_WATER_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_WATER))
						return true;
				case ACTIVE_HOLY_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_HOLY))
						return true;
				case ACTIVE_DARKNESS_ATTACK:
					if (!damage.fromSkill && (damage.element == Element.ELEMENT_DARKNESS))
						return true;
					
				case ACTIVE_NORMAL_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_NORMAL))
						return true;
				case ACTIVE_FIRE_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_FIRE))
						return true;
				case ACTIVE_WIND_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_WIND))
						return true;
				case ACTIVE_EARTH_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_EARTH))
						return true;
				case ACTIVE_THUNDER_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_THUNDER))
						return true;
				case ACTIVE_WATER_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_WATER))
						return true;
				case ACTIVE_HOLY_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_HOLY))
						return true;
				case ACTIVE_DARKNESS_MAGIC:
					if (damage.magical && (damage.element == Element.ELEMENT_DARKNESS))
						return true;
					
				case ACTIVE_NORMAL_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_NORMAL))
						return true;
				case ACTIVE_FIRE_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_FIRE))
						return true;
				case ACTIVE_WIND_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_WIND))
						return true;
				case ACTIVE_EARTH_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_EARTH))
						return true;
				case ACTIVE_THUNDER_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_THUNDER))
						return true;
				case ACTIVE_WATER_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_WATER))
						return true;
				case ACTIVE_HOLY_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_HOLY))
						return true;
				case ACTIVE_DARKNESS_DAMAGED:
					if (!damage.healing && (damage.element == Element.ELEMENT_DARKNESS))
						return true;
				}
			}
		}
		
		return false;
	}
	
	public abstract void onActivate(Damage damage);
}
